package Sj.sj02.util;

import Sj.sj02.dao.CountNum;
import Sj.sj02.dao.impl.*;

public class SimpleDaoFactory {
    /**
     * 创建CountNum实例的工厂方法
     */
    public static CountNum getInstance(String key){
        switch (key){
            case "+":
                return new CountNumImplAdd();
            case "-":
                return new CountNumImplLose();
            case "/":
                return new CountNumImplChu();
            case "*":
                return new CountNumImplChe();
            case "%":
                return new CountNumImplQu();
            default:
                throw new RuntimeException("无效的运算符类型："+key+",DAO获取失败！");
        }
    }
}
